home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
AIncludes
/
StringCompare.a
< prev
next >
Wrap
Text File
|
1996-05-01
|
17KB
|
570 lines
;
; File: StringCompare.a
;
; Contains: Public interfaces for String Comparison and related operations
;
; Version: Technology: System 7.0 through System 8
; Release: Universal Interfaces 3.0d3 on Copland DR1
;
; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
;
; Bugs?: If you find a problem with this file, send the file and version
; information (from above) and the problem description to:
;
; Internet: apple.bugs@applelink.apple.com
; AppleLink: APPLE.BUGS
;
;
IF &TYPE('__STRINGCOMPARE__') = 'UNDEFINED' THEN
__STRINGCOMPARE__ SET 1
IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
include 'Types.a'
ENDIF
IF &TYPE('__TEXTCOMMON__') = 'UNDEFINED' THEN
include 'TextCommon.a'
ENDIF
IF &TYPE('__SCRIPT__') = 'UNDEFINED' THEN
include 'Script.a'
ENDIF
IF &TYPE('__TEXTOBJECTS__') = 'UNDEFINED' THEN
include 'TextObjects.a'
ENDIF
IF &TYPE('__LOCALEOBJECTS__') = 'UNDEFINED' THEN
include 'LocaleObjects.a'
ENDIF
IF &TYPE('__TEXTPARSER__') = 'UNDEFINED' THEN
include 'TextParser.a'
ENDIF
;
;
; Here are the current System 7 routine names and the translations to the older forms.
; Please use the newer forms in all new code and migrate the older names out of existing
; code as maintenance permits.
;
; NEW NAME OLD NAME OBSOLETE FORM (no handle)
;
; CompareString (Str255) IUCompPString (hp only) IUCompString (hp only)
; CompareText (ptr/len) IUMagPString IUMagString
; IdenticalString (Str255) IUEqualPString (hp only) IUEqualString (hp only)
; IdenticalText (ptr/len) IUMagIDPString IUMagIDString
; LanguageOrder IULangOrder
; ScriptOrder IUScriptOrder
; StringOrder (Str255) IUStringOrder (hp only)
; TextOrder (ptr/len) IUTextOrder
;
; RelString
; CmpString (a only)
; EqualString (hp only)
;
; ReplaceText
;
;
IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
; Special language code values for Language Order
systemCurLang EQU -2 ; current (itlbLang) lang for system script
systemDefLang EQU -3 ; default (table) lang for system script
currentCurLang EQU -4 ; current (itlbLang) lang for current script
currentDefLang EQU -5 ; default lang for current script
scriptCurLang EQU -6 ; current (itlbLang) lang for specified script
scriptDefLang EQU -7 ; default language for a specified script
; obsolete names
iuSystemCurLang EQU -2
iuSystemDefLang EQU -3
iuCurrentCurLang EQU -4
iuCurrentDefLang EQU -5
iuScriptCurLang EQU -6
iuScriptDefLang EQU -7
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
IF FOR_SYSTEM8_PREEMPTIVE THEN
; typedef UInt8 * ConstBytePtr
; Collation object key names
; Attribute names and values for CreateCollationRef
; typedef FourCharCode CollateUsageAttributeValue
kCollateUsageDictionary EQU 'dict'
kCollateUsagePhoneDirectory EQU 'phon'
; typedef FourCharCode CollateIdeoOrderAttributeValue
kCollateIdeoOrderRadicalStroke EQU 'rdst'
kCollateIdeoOrderStrokeRadical EQU 'strd'
; Override types and enums
CollationSet RECORD 0
charGroup ds.b 1 ; offset: $0 (0)
charClass ds.b 1 ; offset: $1 (1)
charSubclassMask ds.w 1 ; offset: $2 (2)
sizeof EQU * ; size: $4 (4)
ENDR
; typedef OptionBits CollateSetOptions
kCollateMakeIgnorableBit EQU 0
kCollateSkipPreprocessingBit EQU 1
kCollateIgnoreAnnotationsBit EQU 2
kCollateMakeIgnorableMask EQU $01
kCollateSkipPreprocessingMask EQU $02
kCollateIgnoreAnnotationsMask EQU $04
CollationSetOptionSpec RECORD 0
charGroup ds.b 1 ; offset: $0 (0)
charClass ds.b 1 ; offset: $1 (1)
charSubclassMask ds.w 1 ; offset: $2 (2)
options ds.l 1 ; offset: $4 (4)
sizeof EQU * ; size: $8 (8)
ENDR
; typedef OptionBits CollateNumberOptions
kCollateNumbersByValueBits EQU 0
kCollateAllowThousandsSepBits EQU 2
kCollateMoreThousandsSepBit EQU 4
kCollateAllowIdeoNumbersBit EQU 5
kCollateNumbersByValueMask EQU $03
kCollateAllowThousandsSepMask EQU $0C
kCollateMoreThousandsSepMask EQU $10
kCollateAllowIdeoNumbersMask EQU $20
; values for NumbersByValue subfield
kCollateNumbersByValueUseLocale EQU 0
kCollateNumbersByValueNo EQU 1
kCollateNumbersByValueYes EQU 2 ; values for AllowThousands subfield
kCollateAllowThousandsUseLocale EQU 0
kCollateAllowThousandsNo EQU 1
kCollateAllowThousandsYes EQU 2 ; values for MoreThousands subfield
kCollateMoreThousandsUseLocale EQU 0
kCollateMoreThousandsSkipLocale EQU 1 ; values for AllowIdeoNumbers subfield
kCollateAllowIdeoNumbersNo EQU 0
kCollateAllowIdeoNumbersYes EQU 1
; typedef OptionBits CollateOptions
kCollateStandardOptions EQU 0
; For determining equivalence, differences in encoding and between composed
; and decomposed characters are ignored (they are always significant for
; ordering, however). To change this use the following bits:
kCollateEncodingSensitiveBit EQU 8
kCollateComposeSensitiveBit EQU 9 ; For determining equivalence, diacritics and case are normally significant.
; Use the following bits to change this.
kCollateCaseInsensitiveBit EQU 10
kCollateDiacriticInsensitiveBit EQU 11 ; The following bits determine the ordering for the NoLocale functions only.
kCollateNoLocaleOrderBits EQU 24
kCollateEncodingSensitiveMask EQU $00000100
kCollateComposeSensitiveMask EQU $00000200
kCollateCaseInsensitiveMask EQU $00000400
kCollateDiacriticInsensitiveMask EQU $00000800
kCollateNoLocaleOrderMask EQU $3F000000
; values for NoLocaleOrder subfield
kCollateMacHFSUnicodeCodeOrder EQU 0 ; HFS order for Mac encodings, code order for Unicode
; collation value for GetCollationKeyForTextString
; typedef UInt32 CollationValue
; typedef SInt16 CollateResult
ENDIF
; FOR_SYSTEM8_PREEMPTIVE
IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
;
; The following functions are old names, but are required for System 7 PowerPC builds
; becuase InterfaceLib exports these names, instead of the new ones.
;
;
; pascal short IUMagPString(const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle)
;
IF ¨ GENERATINGCFM THEN
Macro
_IUMagPString
move.w #$001A,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IUMagPString
ENDIF
;
; pascal short IUMagIDPString(const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle)
;
IF ¨ GENERATINGCFM THEN
Macro
_IUMagIDPString
move.w #$001C,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IUMagIDPString
ENDIF
;
; pascal short IUTextOrder(const void *aPtr, const void *bPtr, short aLen, short bLen, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang)
;
IF ¨ GENERATINGCFM THEN
Macro
_IUTextOrder
move.w #$0022,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IUTextOrder
ENDIF
;
; pascal short IUScriptOrder(ScriptCode script1, ScriptCode script2)
;
IF ¨ GENERATINGCFM THEN
Macro
_IUScriptOrder
move.w #$001E,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IUScriptOrder
ENDIF
;
; pascal short IULangOrder(LangCode language1, LangCode language2)
;
IF ¨ GENERATINGCFM THEN
Macro
_IULangOrder
move.w #$0020,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IULangOrder
ENDIF
;
; pascal short CompareText(const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle)
;
IF ¨ GENERATINGCFM THEN
Macro
_CompareText
move.w #$001A,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION CompareText
ENDIF
;
; pascal short IdenticalText(const void *aPtr, const void *bPtr, short aLen, short bLen, Handle itl2Handle)
;
IF ¨ GENERATINGCFM THEN
Macro
_IdenticalText
move.w #$001C,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IdenticalText
ENDIF
;
; pascal short TextOrder(const void *aPtr, const void *bPtr, short aLen, short bLen, ScriptCode aScript, ScriptCode bScript, LangCode aLang, LangCode bLang)
;
IF ¨ GENERATINGCFM THEN
Macro
_TextOrder
move.w #$0022,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION TextOrder
ENDIF
;
; pascal short LanguageOrder(LangCode language1, LangCode language2)
;
IF ¨ GENERATINGCFM THEN
Macro
_LanguageOrder
move.w #$0020,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION LanguageOrder
ENDIF
;
; The following functions are new names that are exported by InterfaceLib
; and work on both 68k and System 7 PowerPC.
;
;
; pascal short ScriptOrder(ScriptCode script1, ScriptCode script2)
;
IF ¨ GENERATINGCFM THEN
Macro
_ScriptOrder
move.w #$001E,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION ScriptOrder
ENDIF
;
; pascal short ReplaceText(Handle baseText, Handle substitutionText, Str15 key)
;
IF ¨ GENERATINGCFM THEN
Macro
_ReplaceText
move.l #$820CFFDC,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION ReplaceText
ENDIF
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
;
; pascal short IUMagString(const void *aPtr, const void *bPtr, short aLen, short bLen)
;
IF ¨ GENERATINGCFM THEN
Macro
_IUMagString
move.w #$000A,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IUMagString
ENDIF
;
; pascal short IUMagIDString(const void *aPtr, const void *bPtr, short aLen, short bLen)
;
IF ¨ GENERATINGCFM THEN
Macro
_IUMagIDString
move.w #$000C,-(sp)
dc.w $A9ED
EndM
ELSE
IMPORT_CFM_FUNCTION IUMagIDString
ENDIF
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
IF FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE THEN
;
; pascal short RelString(ConstStr255Param str1, ConstStr255Param str2, Boolean caseSensitive, Boolean diacSensitive)
;
IF ¨ GENERATINGCFM THEN
_RelString: OPWORD $A050
ELSE
IMPORT_CFM_FUNCTION RelString
ENDIF
;
; pascal short RelStringCase(ConstStr255Param str1, ConstStr255Param str2)
;
IF ¨ GENERATINGCFM THEN
_RelStringCase: OPWORD $A450
ELSE
IMPORT_CFM_FUNCTION RelStringCase
ENDIF
;
; pascal short RelStringMarks(ConstStr255Param str1, ConstStr255Param str2)
;
IF ¨ GENERATINGCFM THEN
_RelStringMarks: OPWORD $A250
ELSE
IMPORT_CFM_FUNCTION RelStringMarks
ENDIF
;
; pascal short RelStringMarksCase(ConstStr255Param str1, ConstStr255Param str2)
;
IF ¨ GENERATINGCFM THEN
_RelStringMarksCase: OPWORD $A650
ELSE
IMPORT_CFM_FUNCTION RelStringMarksCase
ENDIF
;
; pascal short CmpString(ConstStr255Param aStr, ConstStr255Param bStr)
;
IF ¨ GENERATINGCFM THEN
_CmpString: OPWORD $A03C
ELSE
IMPORT_CFM_FUNCTION CmpString
ENDIF
;
; pascal short CmpStringCase(ConstStr255Param aStr, ConstStr255Param bStr)
;
IF ¨ GENERATINGCFM THEN
_CmpStringCase: OPWORD $A43C
ELSE
IMPORT_CFM_FUNCTION CmpStringCase
ENDIF
;
; pascal short CmpStringMarks(ConstStr255Param aStr, ConstStr255Param bStr)
;
IF ¨ GENERATINGCFM THEN
_CmpStringMarks: OPWORD $A23C
ELSE
IMPORT_CFM_FUNCTION CmpStringMarks
ENDIF
;
; pascal short CmpStringMarksCase(ConstStr255Param aStr, ConstStr255Param bStr)
;
IF ¨ GENERATINGCFM THEN
_CmpStringMarksCase: OPWORD $A63C
ELSE
IMPORT_CFM_FUNCTION CmpStringMarksCase
ENDIF
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
IF FOR_SYSTEM8_PREEMPTIVE THEN
;
; extern OSStatus CreateCollationRef(LocaleObjectRef collMasterObject, LocaleRef locale, ItemCount countPairs, const NameValuePair *pairs, CollationRef *newCollationRef)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION CreateCollationRef
ENDIF
;
; extern OSStatus ChangeCollationRef(CollationRef collationRef, LocaleObjectRef collMasterObject, LocaleRef locale, ItemCount countPairs, const NameValuePair *pairs)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION ChangeCollationRef
ENDIF
;
; extern OSStatus OverrideCollationSetOrder(CollationRef collationRef, ItemCount setCount, CollationSet setList[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION OverrideCollationSetOrder
ENDIF
;
; extern OSStatus OverrideCollationSetOptions(CollationRef collationRef, ItemCount specCount, CollationSetOptionSpec specList[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION OverrideCollationSetOptions
ENDIF
;
; extern OSStatus OverrideCollationNumberHandling(CollationRef collationRef, CollateNumberOptions numberOptions, ItemCount tokenCount, BasicToken tokenList[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION OverrideCollationNumberHandling
ENDIF
;
; extern OSStatus DisposeCollationRef(CollationRef *collationRef)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION DisposeCollationRef
ENDIF
;
; extern OSStatus GetCollationKeyForTextObject(CollationRef collationRef, ConstTextObject textObject, CollateOptions options, ItemCount maxCollationValues, ItemCount *actualCollationValues, CollationValue collationKey[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetCollationKeyForTextObject
ENDIF
;
; extern OSStatus GetCollationKeyForTextString(CollationRef collationRef, ConstBytePtr textPtr, ByteCount textLength, TextEncoding textEncoding, CollateOptions options, ItemCount maxCollationValues, ItemCount *actualCollationValues, CollationValue collationKey[2147483647])
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION GetCollationKeyForTextString
ENDIF
;
; extern OSStatus CollateTextObjects(CollationRef collationRef, ConstTextObject textObject1, ConstTextObject textObject2, CollateOptions options, CollateResult *weakOrder, CollateResult *strictOrder)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION CollateTextObjects
ENDIF
;
; extern OSStatus CollateTextStrings(CollationRef collationRef, ConstBytePtr textPtr1, ByteCount textLength1, TextEncoding textEncoding1, ConstBytePtr textPtr2, ByteCount textLength2, TextEncoding textEncoding2, CollateOptions options, CollateResult *weakOrder, CollateResult *strictOrder)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION CollateTextStrings
ENDIF
;
; extern OSStatus EquivalentTextObjects(CollationRef collationRef, ConstTextObject textObject1, ConstTextObject textObject2, CollateOptions options, Boolean *equivalent)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION EquivalentTextObjects
ENDIF
;
; extern OSStatus EquivalentTextStrings(CollationRef collationRef, ConstBytePtr textPtr1, ByteCount textLength1, TextEncoding textEncoding1, ConstBytePtr textPtr2, ByteCount textLength2, TextEncoding textEncoding2, CollateOptions options, Boolean *equivalent)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION EquivalentTextStrings
ENDIF
;
; extern OSStatus FindInTextObject(CollationRef collationRef, ConstTextObject baseText, TextObjectIndex baseStartIndex, TextObjectIndex baseEndIndex, ConstTextObject pattern, TextObjectIndex patStartIndex, TextObjectIndex patEndIndex, CollateOptions options, TextObjectIndex *foundStartIndex, TextObjectIndex *foundEndIndex)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION FindInTextObject
ENDIF
;
; extern OSStatus FindInTextString(CollationRef collationRef, ConstBytePtr baseText, ByteCount baseLength, TextEncoding baseEncoding, ByteOffset baseStartIndex, ByteOffset baseEndIndex, ConstBytePtr patText, ByteCount patLength, TextEncoding patEncoding, ByteOffset patStartIndex, ByteOffset patEndIndex, CollateOptions options, ByteOffset *foundStartIndex, ByteOffset *foundEndIndex)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION FindInTextString
ENDIF
;
; extern OSStatus SubstituteInTextObject(CollationRef collationRef, TextObject baseText, TextObjectIndex startIndex, TextObjectIndex endIndex, ConstTextObject substText, ConstTextObject pattern, CollateOptions options)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SubstituteInTextObject
ENDIF
;
; Locale-insensitive utilities for text objects
; For internal, user-invisible behavior thay must remain invariant across different systems
;
;
; extern OSStatus CollateTextObjectsNoLocale(ConstTextObject textObject1, ConstTextObject textObject2, CollateOptions options, CollateResult *weakOrder, CollateResult *strictOrder)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION CollateTextObjectsNoLocale
ENDIF
;
; extern OSStatus EquivalentTextObjectsNoLocale(ConstTextObject textObject1, ConstTextObject textObject2, CollateOptions options, Boolean *equivalent)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION EquivalentTextObjectsNoLocale
ENDIF
;
; extern OSStatus FindInTextObjectNoLocale(ConstTextObject baseText, TextObjectIndex baseStartIndex, TextObjectIndex baseEndIndex, ConstTextObject pattern, TextObjectIndex patStartIndex, TextObjectIndex patEndIndex, CollateOptions options, TextObjectIndex *foundStartIndex, TextObjectIndex *foundEndIndex)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION FindInTextObjectNoLocale
ENDIF
ENDIF
; FOR_SYSTEM8_PREEMPTIVE
ENDIF ; __STRINGCOMPARE__